<!DOCTYPE html>
<html class="x-admin-sm">
  <head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" href="__ADMIN__/css/font.css">
    <link rel="stylesheet" href="__ADMIN__/css/xadmin.css">
    <script type="text/javascript" src="__ADMIN__/js/jquery.min.js"></script>
    <script type="text/javascript" src="__ADMIN__/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="__ADMIN__/js/xadmin.js"></script>
    <script type="text/javascript" src="__ADMIN__/js/cookie.js"></script>
    <link rel="stylesheet" href="/static/admin/css/font.css">
    <link rel="stylesheet" href="/static/admin/css/font-awesome.min.css">
    <style>
        .layui-form-item .layui-form-label{
            width: 120px;
        }
        .layui-form-item .layui-textarea{
            width: 190px;
        }
        .layui-form-select dl{z-index: 9999;}
        #phone-one-div {display: none}
    </style>
  </head>
  
  <body>
    <div class="x-body">
        <form class="layui-form">
          <input type="hidden" value="{$data.id}" id="id" name="id" autocomplete="off" class="layui-input">
          <div class="layui-form-item">
              <label for="count" class="layui-form-label">
                  <span class="x-red">*</span>标题
              </label>
              <div class="layui-input-inline">
                  <input type="text" value="{$data.title}" lay-verify="required" required id="title" name="title" autocomplete="off" class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label for="activity_name" class="layui-form-label">
                  <span class="x-red">*</span>分类
              </label>
              <div class="layui-input-inline">
                  <select name="cate_id" lay-filter="aihao" lay-verify="required" required>
                    <option value="">请选择</option>
                    {volist name="cateList" id="v"}
                    <option value="{$v.id}" {$data.cate_id==$v.id?'selected':''}>{$v.cate_name}</option>
                    {/volist}
                  </select>
              </div>
          </div>

          <div class="layui-form-item">
              <label for="price" class="layui-form-label">
                  是否置顶
              </label>
              <div class="layui-input-inline">
                    <input type="radio" name="is_top" value="1" title="置顶" {$data.is_top=='1'?'checked':''}>
                    <input type="radio" name="is_top" value="0" title="不置顶" {$data.is_top=='0'?'checked':''}>
              </div>
          </div>

          <div class="layui-form-item"> 
              <textarea  id="container" name="content" type="text/plain" st="" style="height:300px;width:650px">{$data.content}</textarea>
          </div>
          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
              </label>
              <button type="button" class="layui-btn" lay-filter="add" lay-submit="">
                  确定
              </button>
          </div>
      </form>
    </div>
    
    <script src="/static/admin/plus/ueditor/ueditor.config.js"></script>
    <script src="/static/admin/plus/ueditor/ueditor.all.js"></script>
    <script>
/*
        const E = window.wangEditor
        const editor = new E('#div1');
        const $text1 = $('#note');
        editor.config.onchange = function (html) {
            $text1.val(html);
        }
        editor.config.placeholder = '详细内容...';
        editor.config.height = 250;
        editor.config.height = 250;
        editor.config.MENU_CONF = {
          uploadImage: {
            fieldName: 'your-fileName',
            base64LimitSize: 10 * 1024 * 1024 // 10M 以下插入 base64
          }
        },
        editor.create();
        
        $text1.val(editor.txt.html())
        window.toolbar = E.createToolbar({
          editor,
          selector: '#editor-toolbar',
          config: {}
        })*/
    
    layui.use(['form','layer','laydate','upload','layarea','rate'], function(){
          $ = layui.jquery;
          var form = layui.form
          ,layer = layui.layer
          ,laydate = layui.laydate
          ,upload = layui.upload
          ,layarea = layui.layarea
          ,rate = layui.rate;
          
        var ue = UE.getEditor('container',{
            autoHeight: false
        });
          //监听提交
        form.on('submit(add)', function(data){
            $.ajax({
                type:'POST',
                dataType:'json',
                data:{data:data.field},
                success:function(obj){
                      layer.alert(obj.msg, {icon: obj.icon},function(){
                        // 获得frame索引
                        var index = parent.layer.getFrameIndex(window.name);
                        //关闭当前frame
                        parent.layer.close(index);
                        // 可以对父窗口进行刷新 
                        x_admin_father_reload();
                      });    
                }
            });
            return false;
        });
    });
    </script>
  </body>

</html>